import 'package:enterprise_v6_app/generated/json/base/json_convert_content.dart';
import 'package:enterprise_v6_app/app/data/entities/application/emergency/node_tasks_entity.dart';

NodeTasksEntity $NodeTasksEntityFromJson(Map<String, dynamic> json) {
  final NodeTasksEntity nodeTasksEntity = NodeTasksEntity();
  final String? desc = jsonConvert.convert<String>(json['desc']);
  if (desc != null) {
    nodeTasksEntity.desc = desc;
  }
  final String? nodeId = jsonConvert.convert<String>(json['nodeId']);
  if (nodeId != null) {
    nodeTasksEntity.nodeId = nodeId;
  }
  final String? nodeName = jsonConvert.convert<String>(json['nodeName']);
  if (nodeName != null) {
    nodeTasksEntity.nodeName = nodeName;
  }
  final List<NodeTasksTasks>? tasks = (json['tasks'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<NodeTasksTasks>(e) as NodeTasksTasks).toList();
  if (tasks != null) {
    nodeTasksEntity.tasks = tasks;
  }
  final bool? isExpanded = jsonConvert.convert<bool>(json['isExpanded']);
  if (isExpanded != null) {
    nodeTasksEntity.isExpanded = isExpanded;
  }
  final bool? isSelect = jsonConvert.convert<bool>(json['isSelect']);
  if (isSelect != null) {
    nodeTasksEntity.isSelect = isSelect;
  }
  return nodeTasksEntity;
}

Map<String, dynamic> $NodeTasksEntityToJson(NodeTasksEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['desc'] = entity.desc;
  data['nodeId'] = entity.nodeId;
  data['nodeName'] = entity.nodeName;
  data['tasks'] = entity.tasks.map((v) => v.toJson()).toList();
  data['isExpanded'] = entity.isExpanded;
  data['isSelect'] = entity.isSelect;
  return data;
}

extension NodeTasksEntityExtension on NodeTasksEntity {
  NodeTasksEntity copyWith({
    String? desc,
    String? nodeId,
    String? nodeName,
    List<NodeTasksTasks>? tasks,
    bool? isExpanded,
    bool? isSelect,
  }) {
    return NodeTasksEntity()
      ..desc = desc ?? this.desc
      ..nodeId = nodeId ?? this.nodeId
      ..nodeName = nodeName ?? this.nodeName
      ..tasks = tasks ?? this.tasks
      ..isExpanded = isExpanded ?? this.isExpanded
      ..isSelect = isSelect ?? this.isSelect;
  }
}

NodeTasksTasks $NodeTasksTasksFromJson(Map<String, dynamic> json) {
  final NodeTasksTasks nodeTasksTasks = NodeTasksTasks();
  final String? companyCode = jsonConvert.convert<String>(json['companyCode']);
  if (companyCode != null) {
    nodeTasksTasks.companyCode = companyCode;
  }
  final String? createBy = jsonConvert.convert<String>(json['createBy']);
  if (createBy != null) {
    nodeTasksTasks.createBy = createBy;
  }
  final String? createById = jsonConvert.convert<String>(json['createById']);
  if (createById != null) {
    nodeTasksTasks.createById = createById;
  }
  final String? createDate = jsonConvert.convert<String>(json['createDate']);
  if (createDate != null) {
    nodeTasksTasks.createDate = createDate;
  }
  final String? deleted = jsonConvert.convert<String>(json['deleted']);
  if (deleted != null) {
    nodeTasksTasks.deleted = deleted;
  }
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    nodeTasksTasks.id = id;
  }
  final String? nodeId = jsonConvert.convert<String>(json['nodeId']);
  if (nodeId != null) {
    nodeTasksTasks.nodeId = nodeId;
  }
  final String? processEncoding = jsonConvert.convert<String>(json['processEncoding']);
  if (processEncoding != null) {
    nodeTasksTasks.processEncoding = processEncoding;
  }
  final String? taskInfo = jsonConvert.convert<String>(json['taskInfo']);
  if (taskInfo != null) {
    nodeTasksTasks.taskInfo = taskInfo;
  }
  final String? updateBy = jsonConvert.convert<String>(json['updateBy']);
  if (updateBy != null) {
    nodeTasksTasks.updateBy = updateBy;
  }
  final String? updateById = jsonConvert.convert<String>(json['updateById']);
  if (updateById != null) {
    nodeTasksTasks.updateById = updateById;
  }
  final String? updateDate = jsonConvert.convert<String>(json['updateDate']);
  if (updateDate != null) {
    nodeTasksTasks.updateDate = updateDate;
  }
  final List<String>? userIdList = (json['userIdList'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<String>(e) as String).toList();
  if (userIdList != null) {
    nodeTasksTasks.userIdList = userIdList;
  }
  final String? userList = jsonConvert.convert<String>(json['userList']);
  if (userList != null) {
    nodeTasksTasks.userList = userList;
  }
  final List<String>? userNameList = (json['userNameList'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<String>(e) as String).toList();
  if (userNameList != null) {
    nodeTasksTasks.userNameList = userNameList;
  }
  final int? whetherToDrill = jsonConvert.convert<int>(json['whetherToDrill']);
  if (whetherToDrill != null) {
    nodeTasksTasks.whetherToDrill = whetherToDrill;
  }
  final bool? isSelect = jsonConvert.convert<bool>(json['isSelect']);
  if (isSelect != null) {
    nodeTasksTasks.isSelect = isSelect;
  }
  return nodeTasksTasks;
}

Map<String, dynamic> $NodeTasksTasksToJson(NodeTasksTasks entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['companyCode'] = entity.companyCode;
  data['createBy'] = entity.createBy;
  data['createById'] = entity.createById;
  data['createDate'] = entity.createDate;
  data['deleted'] = entity.deleted;
  data['id'] = entity.id;
  data['nodeId'] = entity.nodeId;
  data['processEncoding'] = entity.processEncoding;
  data['taskInfo'] = entity.taskInfo;
  data['updateBy'] = entity.updateBy;
  data['updateById'] = entity.updateById;
  data['updateDate'] = entity.updateDate;
  data['userIdList'] = entity.userIdList;
  data['userList'] = entity.userList;
  data['userNameList'] = entity.userNameList;
  data['whetherToDrill'] = entity.whetherToDrill;
  data['isSelect'] = entity.isSelect;
  return data;
}

extension NodeTasksTasksExtension on NodeTasksTasks {
  NodeTasksTasks copyWith({
    String? companyCode,
    String? createBy,
    String? createById,
    String? createDate,
    String? deleted,
    String? id,
    String? nodeId,
    String? processEncoding,
    String? taskInfo,
    String? updateBy,
    String? updateById,
    String? updateDate,
    List<String>? userIdList,
    String? userList,
    List<String>? userNameList,
    int? whetherToDrill,
    bool? isSelect,
  }) {
    return NodeTasksTasks()
      ..companyCode = companyCode ?? this.companyCode
      ..createBy = createBy ?? this.createBy
      ..createById = createById ?? this.createById
      ..createDate = createDate ?? this.createDate
      ..deleted = deleted ?? this.deleted
      ..id = id ?? this.id
      ..nodeId = nodeId ?? this.nodeId
      ..processEncoding = processEncoding ?? this.processEncoding
      ..taskInfo = taskInfo ?? this.taskInfo
      ..updateBy = updateBy ?? this.updateBy
      ..updateById = updateById ?? this.updateById
      ..updateDate = updateDate ?? this.updateDate
      ..userIdList = userIdList ?? this.userIdList
      ..userList = userList ?? this.userList
      ..userNameList = userNameList ?? this.userNameList
      ..whetherToDrill = whetherToDrill ?? this.whetherToDrill
      ..isSelect = isSelect ?? this.isSelect;
  }
}
